<template>
  <view class="information-container">
    <!-- 头像和名字区域 -->
    <view class="imgAndName-box">
      <image src="../../static/tx.jpg" class="info-img"></image>
      <text class="info-name">Long</text>
    </view>
    <!-- 面板区域 -->
    <view class="panel-box">
      <!-- 第一个面板 -->
      <view class="panel">
        <view class="panel-body">
          <view class="panel-item">
            <view class="item-number">
              8
            </view>
            <view class="item-title">
              收藏的店铺
            </view>
          </view>
          <view class="panel-item">
            <view class="item-number">
              14
            </view>
            <view class="item-title">
              收藏的商品
            </view>
          </view>
          <view class="panel-item">
            <view class="item-number">
              18
            </view>
            <view class="item-title">
              关注的商品
            </view>
          </view>
          <view class="panel-item">
            <view class="item-number">
              84
            </view>
            <view class="item-title">
              足迹
            </view>
          </view>
        </view>
      </view>
      <!-- 第二个面板 -->
      <view class="panel">
        <view class="panel-title">
          我的订单
        </view>
        <view class="panel-body">
          <view class="panel-item">
           <uni-icons type="icon-daifukuan" custom-prefix="iconfont" size="40" color="#c97c8f"></uni-icons>
            <view class="item-title">
              待付款
            </view>
          </view>
          <view class="panel-item">
           <uni-icons type="icon-daishouhuo" custom-prefix="iconfont" size="40" color="#c97c8f"></uni-icons>
            <view class="item-title">
              待收货
            </view>
          </view>
          <view class="panel-item">
          <uni-icons type="icon-tuikuan" custom-prefix="iconfont" size="40" color="#c97c8f"></uni-icons>
            <view class="item-title">
              退款/退货
            </view>
          </view>
          <view class="panel-item">
          <uni-icons type="icon-quanbudingdan" custom-prefix="iconfont" size="40" color="#c97c8f"></uni-icons>
            <view class="item-title">
              全部订单
            </view>
          </view>
        </view>
      </view>
      <!-- 第三个面板 -->
      <view class="panel">
        <view class="panel-list-item">
          <view class="item-title">
            收货地址
          </view>
          <uni-icons type="arrowright" size="15"></uni-icons>
        </view>
        <view class="panel-list-item">
          <view class="item-title">
            联系客服
          </view>
          <uni-icons type="arrowright" size="15"></uni-icons>
        </view>
        <view class="panel-list-item" @click="loginOut">
          <view class="item-title">
            退出登录
          </view>
          <uni-icons type="arrowright" size="15"></uni-icons>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  import { mapMutations } from 'vuex'
  export default {
    name:"my-information",
    data() {
      return {
        
      };
    },
    methods: {
      ...mapMutations('m_user', ['userLoginOut']),
      // 退出登录
      loginOut() {
        uni.showModal({
          title: '退出登录',
          content: '是否确认退出登录!',
          success: ({ confirm, cancel }) => {
            if(confirm) {
              this.userLoginOut()
            }
          },
          fail(err) {
            console.log(err)
          }
        })
      }
    }
  }
</script>

<style lang="scss">
  .information-container {
    height: 100%;
    background-color: #f4f3f2;
  }
  .imgAndName-box {
    height: 400rpx;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #C00000;
    
    .info-img {
      width: 90px;
      height: 90px;
      border: 2px solid #FFFFFF;
      border-radius: 50%;
    }
    
    .info-name {
      font-size: 16px;
      font-weight: 700;
      margin-top: 10px;
      color: #FFFFFF;
    }
  }
  
  .panel-box {
    position: relative;
    top: -10px;
    padding: 0 10px;
    
    .panel {
      background-color: #FFFFFF;
      border-radius: 3px;
      margin-bottom: 10px;
      
      &:last-of-type {
        margin-bottom: 0;
      }
      
      .panel-title {
        padding-left: 10px;
        line-height: 45px;
        border-bottom: 1px solid #f4f4f4;
        font-size: 15px;
      }
      
      .panel-body {
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 10px 0;
        
        .panel-item {
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          font-size: 13px;
        }
      }
    }
    
    .panel-list-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15px 10px;
    }
  }
</style>
